class Solution:
    def letterCombinations(self, digits):
        dic={2:['a','b','c'], 3:['d','e','f'],4:['g','h','i'],5:['j','k','l']
        ,6:['m','n','o'],7:['p','q','r','s'],8:['t','u','v'],9:['w','x','y','z']}
        res=[]
        if  digits==None or len(digits)==0:
            return res
        length=len(digits)
        def dfs(num, str, res):
            if num==length:
                res.append(str)
                return
            for letter in dic[int(digits[num])]:
                dfs(num+1,str+letter,res)
        dfs(0,'',res)
        return res

def main():
    s=Solution
    print(s.letterCombinations(None,"234"))

main()